<%@ page language="java" pageEncoding="UTF-8" buffer="16kb"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<%@ include file="/module/js.jsp"%>
<%@ include file="/module/orderField.jsp"%>
<script type="text/javascript" src="${basePath}/js/jquery.Huploadify.js"></script>
<link href="${basePath}/css/Huploadify.css" rel="stylesheet">
	<style>
table label.error {
	margin-left: 5px;
	width: auto;
	display: inline;
	color: red;
}
</style>
<script>
   $(document).ready(
					function() {
						$("#div2").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : true,
							title : '选择委员',
							autoOpen : false,
						    buttons : {
						    '取消' : function() {
						    	$(this).dialog('close');
							},
							'确定' : function() {
							 /*   if($("#toSelect2").val()==null||$("#toSelect2").val()==""){
								 alert("请选择一项");
								 return false;
							  }  */
							  var wyxm_id = $("#toSelect2 option").map(function(){
								     return $(this).val();
								 }).get().join(",")
							  var wyxm_name = $("#toSelect2 option").map(function(){
								     return $(this).text();
								 }).get().join(",")
						      $("#wyxm").val(wyxm_name);
							  $("#wyxm_id").val(wyxm_id);
							  $(this).dialog('close');
							}
						  }
						});
						$("#div1").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择负责人',
							autoOpen : false,
						    buttons : {
						    '取消' : function() {
						    	$(this).dialog('close');
							},
							'确定' : function() {
							  
							  if($("#fromSelect").val()==null||$("#fromSelect").val()==""){
								 alert("请选择一项");
								 return false;
							  }else{
								    var formSelect = document.getElementById("fromSelect");
								    var str = [];
								    var num=0;
								    for(i=0;i<formSelect.length;i++){
								        if(formSelect.options[i].selected){
								            //str.push(select[i].value);
								            num++;
								        }
								    }
								    if(num>=2){
								      layer.alert("只能选择一项", {icon: 6});
								      return false;
								    }
								  
								  var str=$("#fromSelect").val()+"";
								  var strs = str.split(","); 
								  for(i=0;i<strs.length;i++){
									  if(i==0){
										  $("#dbempid").val(strs[i]);
                                      }
									  if(i==1){
										  $("#dbzgh").val(strs[i]);  
									  }
								  }
								
						        $("#dZBSJXM").val($("#fromSelect").find("option:selected").text()); 
								$("#dZBSJID").val($("#fromSelect").find("option:selected").val());
								  $(this).dialog('close');
							  }	  
							}
						  }
						});
						$("#div3").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择负责人',
							autoOpen : false,
							buttons : {
								'取消' : function() {
									$(this).dialog('close');
								},
								'确定' : function() {

									if($("#fromSelect3").val()==null||$("#fromSelect3").val()==""){
										alert("请选择一项");
										return false;
									}else{
										var formSelect = document.getElementById("fromSelect3");
										var str = [];
										var num=0;
										for(i=0;i<formSelect.length;i++){
											if(formSelect.options[i].selected){
												//str.push(select[i].value);
												num++;
											}
										}
										if(num>=2){
											layer.alert("只能选择一项", {icon: 6});
											return false;
										}

										var str=$("#fromSelect3").val()+"";
										var strs = str.split(",");
										for(i=0;i<strs.length;i++){
											if(i==0){
												$("#dbempid").val(strs[i]);
											}
											if(i==1){
												$("#dbzgh").val(strs[i]);
											}
										}
										$("#zZWYXM").val($("#fromSelect3").find("option:selected").text());
										$("#zZWYID").val($("#fromSelect3").find("option:selected").val());
										$(this).dialog('close');
									}
								}
							}
						});
						$("#div4").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择负责人',
							autoOpen : false,
							buttons : {
								'取消' : function() {
									$(this).dialog('close');
								},
								'确定' : function() {

									if($("#fromSelect4").val()==null||$("#fromSelect4").val()==""){
										alert("请选择一项");
										return false;
									}else{
										var formSelect = document.getElementById("fromSelect4");
										var str = [];
										var num=0;
										for(i=0;i<formSelect.length;i++){
											if(formSelect.options[i].selected){
												//str.push(select[i].value);
												num++;
											}
										}
										if(num>=2){
											layer.alert("只能选择一项", {icon: 6});
											return false;
										}

										var str=$("#fromSelect4").val()+"";
										var strs = str.split(",");
										for(i=0;i<strs.length;i++){
											if(i==0){
												$("#dbempid").val(strs[i]);
											}
											if(i==1){
												$("#dbzgh").val(strs[i]);
											}
										}
										$("#xCWYXM").val($("#fromSelect4").find("option:selected").text());
										$("#xCWYID").val($("#fromSelect4").find("option:selected").val());
										$(this).dialog('close');
									}
								}
							}
						});
					});
	function showdiv() {
		$('#div1').dialog('open');
	}
   function showdiv3() {
	   $('#div3').dialog('open');
   }
   function showdiv4() {
	   $('#div4').dialog('open');
   }
	function showdiv2() {
		$('#div2').dialog('open');
	}
</script>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="wyxm_id" id="wyxm_id" value="${dZBWY_ID}" />
		<input type="hidden" name="dZBSJID" id="dZBSJID" value="${partyBranch.dZBSJID }" />
		<table cellpadding="0" cellspacing="0" border="0" class="table-border"
			width="95%">
			<tr>
				<td class="table-header" colspan="4">党支部信息</td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 15%">
					<font style="color: red;">*</font>党支部名称:
				</td>
				<td class="table-contentTD" style="width:35%">
				   <input type="hidden" name="zBID" id="zBID" value="${partyBranch.zBID}" />
				   <input type="text" id="dZBMC" name="dZBMC" placeholder="党支部名称"  maxlength="100" class="inputText required" style="width: 70%" value="${partyBranch.dZBMC}"/>
				</td>
				<td class="table-titleTD" style="width: 15%">成立日期:</td>
				<td class="table-contentTD" style="width: 35%">
				    <input name="cLRQ" id="cLRQ" placeholder="成立日期" autocomplete="off"
					   class="Wdate inputText2" value="${partyBranch.cLRQ}"
					   onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
			    </td>
			</tr>
			
			 <tr>
				<td class="table-titleTD" style="width: 15%">
					<font style="color: red;">*</font>党支部书记:
				</td>
				<td class="table-contentTD" style="width: 35%">
				<input type="text" id="dZBSJXM" name="dZBSJXM" value="${partyBranch.dZBSJXM}"  readonly="readonly"  placeholder="党支部书记"  style="width: 70%" maxlength="100" class="inputText required"/>&nbsp&nbsp;
				<input type="button" id="optionBtn" value="选择" class="inputButton"
					onclick="javascript:showdiv();" placeholder="请选择书记"/>
			    </td>
			    <td class="table-titleTD" style="width: 15%">本届届满日期:</td>
				<td class="table-contentTD" style="width:35%">
				   <input name="bJJMRQ" id="bJJMRQ" placeholder="担任开始日期"  autocomplete="off" 
					   class="Wdate inputText2"  value="${partyBranch.bJJMRQ}" 
					    onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
			    </td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 15%">组织委员:</td>
				<td class="table-contentTD" style="width: 35%">
					<input type="text" id="zZWYXM" name="zZWYXM" value="${partyBranch.zZWYXM}"  readonly="readonly"    placeholder="组织委员"  style="width: 60%" maxlength="100" class="inputText"/>&nbsp&nbsp;
					<input type="button" id="optionBtn3" value="选择" class="inputButton"
						   onclick="javascript:showdiv3();" placeholder="请选择组织委员"/>
				</td>
				<td class="table-titleTD" style="width: 15%">宣传委员:</td>
				<td class="table-contentTD" style="width: 35%">
					<input type="text" id="xCWYXM" name="xCWYXM" value="${partyBranch.xCWYXM}"  readonly="readonly"  placeholder="宣传委员"  style="width: 60%" maxlength="100" class="inputText"/>&nbsp&nbsp;
					<input type="button" id="optionBtn4" value="选择" accept="" accesskey=""  class="inputButton"
						   onclick="javascript:showdiv4();" placeholder="请选择宣传委员"/>
				</td>
			</tr>
		    <tr>
			     <td class="table-titleTD" style="width: 10%">党支部委员:</td>
			     <td class="table-contentTD" colspan="3" style="width: auto;">
				  <input type="text" id="wyxm" name="wyxm" value="${dZBWY_NAME}" maxlength="100" readonly="readonly" class="inputText" style="width: 80%" placeholder="党支部委员"/>&nbsp&nbsp;
					<input type="button" id="optionBtn2" value="选择" class="inputButton"
					onclick="javascript:showdiv2();" placeholder="请选择学生"/>
			    </td>		
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 15%">备注:</td>
				<td class="table-contentTD" colspan="3" style="width: auto;">
				 <textarea rows="5" cols="50" name="remark" id="remark"  placeholder="备注" class="inputText"  maxlength="2000" >${partyBranch.remark}</textarea>
			    </td>
			</tr> 
		</table>
		<br />

		<table cellpadding="1" cellspacing="1" border="0" align="left">
		<c:if test="${_login_user_type==2}">
			<tr>
				<td>
				<kl:permission permisstionList="${permisstionList}"
               currentUser="${_login_console_user}"
               currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_GRDJ_DZB\")%>" key="modify">
				<input type="button" id="btnSave" class="inputButton"
					style="text-align: center;" value="保存" />
				</kl:permission>
				</td>
				<td>
				<kl:permission permisstionList="${permisstionList}"
				 currentUser="${_login_console_user}"
               currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_GRDJ_DZB\")%>" key="modify">
				<input type="button" id="btnSaveContinue" class="inputButton"
					style="text-align: center;" value="保存并新增" />
				</kl:permission>
				</td>
				<td><input type="button" id="Cancel" class="inputButton"
					style="text-align: center;" value="取消" /></td>
				<td><input type="button" id="returnBut" class="inputButton"
					value="返回" style="text-align: center;" /></td>
			</tr>
			</c:if>
		</table>
	</form>
	<div id="div1" style="display: none;">
			<table cellpadding="0" cellspacing="0" border="0" class="table-border">
				  <tr>
					  	 <td style="clear:both; width: 70%">
					  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect','fromSelect','fromSelect',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect','fromSelect','fromSelect',this.value);"/><font color="green">在此查找</font> <br/>
					  	   <br/><label style="color:red;">未选中:</label><br/>
					  	   <select name="fromSelect" id="fromSelect" multiple="multiple"  size="1"  multiple="false" style="width:200px; height: 250px;"
								ondblclick="moveField('fromSelect','toSelect');">
									<c:forEach items="${employees}" var="data">
							       <option value="${data.emid}">${data.xm}</option>
						          </c:forEach>
							</select>
								<select name="sourseFromSelect" id="sourseFromSelect"   multiple="false" style="width: 220px; height: 150px; display: none;" >
									  <c:forEach items="${employees}" var="data">
								       <option value="${data.emid}">${data.xm}</option>
							          </c:forEach>
	  	                        </select>
						  </td>
  	              </tr>
			</table>
	    </div>

	<div id="div3" style="display: none;">
		<table cellpadding="0" cellspacing="0" border="0" class="table-border">
			<tr>
				<td style="clear:both; width: 70%">
					<input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect3','fromSelect3','toSelect3',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect3','fromSelect3','fromSelect3',this.value);"/><font color="green">在此查找</font> <br/>
					<br/><label style="color:red;">未选中:</label><br/>
					<select name="fromSelect3" id="fromSelect3" multiple="multiple"  size="1"  multiple="false" style="width:200px; height: 250px;"
							ondblclick="moveField('fromSelect3','toSelect3');">
						<c:forEach items="${employees}" var="data">
							<option value="${data.emid}">${data.xm}</option>
						</c:forEach>
					</select>
					<select name="sourseFromSelect3" id="sourseFromSelect3"   multiple="false" style="width: 220px; height: 150px; display: none;" >
						<c:forEach items="${employees}" var="data">
							<option value="${data.emid}">${data.xm}</option>
						</c:forEach>
					</select>
				</td>
			</tr>
		</table>
	</div>
	<div id="div4" style="display: none;">
		<table cellpadding="0" cellspacing="0" border="0" class="table-border">
			<tr>
				<td style="clear:both; width: 70%">
					<input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect4','fromSelect4','toSelect4',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect4','fromSelect4','fromSelect4',this.value);"/><font color="green">在此查找</font> <br/>
					<br/><label style="color:red;">未选中:</label><br/>
					<select name="fromSelect4" id="fromSelect4" multiple="multiple"  size="1"  multiple="false" style="width:200px; height: 250px;"
							ondblclick="moveField('fromSelect4','toSelect4');">
						<c:forEach items="${employees}" var="data">
							<option value="${data.emid}">${data.xm}</option>
						</c:forEach>
					</select>
					<select name="sourseFromSelect4" id="sourseFromSelect4"   multiple="false" style="width: 220px; height: 150px; display: none;" >
						<c:forEach items="${employees}" var="data">
							<option value="${data.emid}">${data.xm}</option>
						</c:forEach>
					</select>
				</td>
			</tr>
		</table>
	</div>


	<div id="div2" style="display: none;">
			<table cellpadding="0" cellspacing="0" border="0"
				class="table-border">
				  <tr>
  	   <td style="clear:both; width: 45%">
  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2','fromSelect2','toSelect2',this.value);"  
  	  onkeyup="javascript:filterSelectItems('sourseFromSelect2','fromSelect2','toSelect2',this.value);"/><font color="green">在此查找</font> <br/>
  	   <br/><label style="color:red;">未选中:</label><br/>
  	   <select name="fromSelect2" id="fromSelect2" multiple="multiple" class="inputText" style="width:220px; height: 300px;"
			ondblclick="moveField('fromSelect2','toSelect2');">
						<c:forEach items="${employees}" var="data">
							     <option value="${data.emid}">${data.xm}</option>
						</c:forEach>
		</select>
		<select name="sourseFromSelect2" id="sourseFromSelect2" multiple="multiple" class="inputText" style="width:220px; height: 150px;display: none;" 
					ondblclick="moveField('fromSelect2','toSelect2');">
			<c:forEach items="${employees}" var="data">
				<option value="${data.emid}">${data.xm}</option>
			</c:forEach>
				</select>
  	    </td>
  	    <td align="center" style="width: 10%">
  	    <input type="button"  class="inputButton" onclick="moveAllField('fromSelect2','toSelect2');" style="width: 40px;" value=">>" />
		<br>
		 <br/>
		<input type="button" 
			onclick="moveField('fromSelect2','toSelect2');"
			style="width: 40px;" value=">"  class="inputButton"/>
	   <br/>
	    <br/>
		<input type="button"   style="width: 40px;" class="inputButton" value="&lt" onclick="moveField('toSelect2','fromSelect2');"/><br/> <br/>
     	<input type="button" style="width: 40px;"  class="inputButton"  onclick="moveAllField('toSelect2','fromSelect2');"  value="&lt&lt" />
     </td>
     <td style="width: 45%"><br/><br/><label style="color:red;">已选中:</label><br/>
     <select name="toSelect2" id="toSelect2" multiple="multiple"  class="text"   style="width:220px;height: 300px;" ondblclick="moveField('toSelect2','fromSelect2');">
			<c:forEach items="${plList}" var="data2">
					<option value="${data2.empId}">${data2.empName}</option>
		    </c:forEach>
		</select>
     </td>
  	   </tr>
		</table>
  </div>
	<script>
			$(document).ready(function() {
				var _form=$("#Form").validate();
				/* 保存  */
				$("#btnSave").click(function() {
					if(_form.form()){
						validataSave();
					}
				});
				/* 保存并新增  */
				$("#btnSaveContinue").click(function() {
					if(_form.form()){
						  validataSaveContinue();
					}
				});
				
				function validataSave(){
						    document.Form.action ="${basePath}/dzb/update?action=1";
							document.Form.submit();
						/*       }   
						  }
						});   */
				}
				function validataSaveContinue(){
							    document.Form.action ="${basePath}/dzb/update?action=2";
								document.Form.submit();
						 /*   }   
						  }
						});	 */
				}
				/* 返回 */
				$("#returnBut").click(function() {
		 			   window.location.href='${basePath}/dzb/list';
		 		});
				/*  取消 */
				$("#Cancel").click(function() {
					   window.location.href = "${basePath}/dzb/add";
		 		});
			});
			
			   if("${msg}"!=""){
			       layer.alert("${msg}", {icon: 6});
			  } 
			/* 选择 */
		   function showdiv() {
				$('#div1').dialog('open');
			} 
		   if("${msg}"!=""){
		       layer.alert("${msg}", {icon: 6});
		  }
		   
		</script>
</body>
</html>
